package com.t.bricks.bussiness.db.dao.recharge;

import com.t.bricks.bussiness.db.entity.recharge.Recharge;
import com.t.bricks.bussiness.db.entity.recharge.base.CustomerAccountBase;
import com.t.bricks.bussiness.db.entity.recharge.base.TallyBase;
import com.t.bricks.bussiness.db.entity.recharge.base.WechatRefundBase;
import com.t.bricks.model.MsgEmity;
import com.t.bricks.model.Page;

public interface RechargeDao {
	
	/**
	 * 添加
	 * @Param recharge
	 * @return MsgEmity
	 */
	MsgEmity add(Recharge recharge);

	/**
	 * 标记删除
	 * @Param recharge
	 * @return MsgEmity
	 */
	MsgEmity signDel(Recharge recharge);

	/**
	 * 修改状态
	 * @param recharge
	 * @return
	 */
	MsgEmity changeState(Recharge recharge);

	/**
	 * 根据编号查询指定订单
	 * @param uId
	 * @return
	 */
	MsgEmity findById(String uId);

	/**
	 * 查询指定订单
	 * @param sOrderNo
	 * @return
	 */
	MsgEmity findByOrder(String sOrderNo);

	/**
	 * 查询指定订单的状态
	 * @param sOrderNo
	 * @return
	 */
	MsgEmity findState(String sOrderNo);

	/**
	 * 查询指定状态的订单
	 * @param iState
	 * @return
	 */
	MsgEmity findByState(int iState);

	/**
	 * 查询指定订单是否存在(存在返回值大于0)
	 * @param sOrderNo
	 * @return
	 */
	MsgEmity findCountByOrder(String sOrderNo);
	
	/**
	 * 查询分页信息
	 * @param iStates
	 * @param page
	 * @return
	 */
	MsgEmity findByPage(Integer[] iStates, Page page);
	
	/**
	 * 取充值对应的积分
	 * @param iType
	 * @param sValue
	 * @return
	 */
	MsgEmity getRechargeTally(int iType, String sValue);
	
	/**
	 * 查询顾客账户
	 * @param sId
	 * @return
	 */
	MsgEmity findCustomer(String sId);
	
	/**
	 * 同步更新顾客账户中的余额与积分
	 * @param recharge
	 * @param tallyBase
	 * @param customerAccountBase
	 * @return
	 */
	MsgEmity changeCustomerAccount(Recharge recharge, TallyBase tallyBase,
			CustomerAccountBase customerAccountBase);
	
	/**
	 * 错误值累加
	 * @param uId
	 * @return
	 */
	MsgEmity addErrorCount(String uId);

	/**
	 * 新增微信退款记录
	 * @param wechatRefund
	 * @return
	 */
	MsgEmity addWechatRefund(WechatRefundBase wechatRefund);
	
	/**
	 * 判断微信退款记录是否存在,存在返回非0
	 * @param sId
	 * @return
	 */
	MsgEmity hasWechatRefund(String sId);
	
}
